package com.xyb.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SysUserVo {
    public interface insert {}
    public interface update {}
    public interface status {}

    /**
     * 用户id
     */
    @NotNull(message="用户id不能为空",groups = SysMenuVo.update.class)
    private Long userId;
    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空", groups = {SysUserVo.insert.class,SysUserVo.update.class})
    @Length(max = 100, message = "用户名不得超过100个字符")
    private String userName;
    /**
     * 用户昵称
     */
    @Length(max = 100, message = "用户昵称不得超过100个字符", groups = {SysUserVo.insert.class,SysUserVo.update.class})
    private String userNickName;
    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空", groups = {SysUserVo.insert.class,SysUserVo.update.class})
    @Pattern(regexp = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(166)|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$", message = "手机号格式错误", groups = {SysUserVo.insert.class,SysUserVo.update.class})
    private String iphoneNo;
    /**
     * 用户密码
     */
    @NotBlank(message = "密码不能为空")
    @Length(min = 6, max = 18, message = "请设置6到18个字符之间的密码", groups = {SysUserVo.insert.class})
    private String userPwd;
    /**
     * 头像图片 url
     */
    private String headPortraitUrl;
    /**
     * 用户状态
     * 1 使用中
     * 0 冻结
     * -1 删除
     */
    @Range(min = 0, max = 1, message = "状态只能是1或0", groups = {SysUserVo.insert.class,SysUserVo.update.class})
    @NotNull(message = "状态不能为空",groups = SysUserVo.status.class)
    private Integer status;
    /**
     * 显示顺序
     */
    private Long showOrder;
    /**
     * 创建时间
     */
    private Date createTime;

    //角色
    private List<Long> roleIds;
}
